home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-06-24 | 4.4 KB | 105 lines | [TEXT/pdos] |
- *******************************************************************************
- *
- * Developer Technical Support Apple II Sample Code
- *
- * This is a simple standard header for MPWIIGS Pascal NDAs. It must be linked
- * first to the Pascal NDA code.
- *
- * Stack Note: This header cannot be used with NDAs that require large amounts
- * of stack space. The NDA will share the application's stack.
- *
- * SANE Note: If your NDA is using any real data types (i.e., real, single,
- * double, extended, comp, or computational types) or if you are
- * using any built in procedures or functions that support real
- * data types (i.e., Readln, Writeln, Trunc, Round, etc.), you
- * cannot use this header with your NDA.
- *
- * Three lines in this header should be changed before you build your NDA.
- * The three lines are labeled NDAPeriod, NDAEventMask and NDAMenuLine.
- * See the Apple IIGS Toolbox Reference: Volume 1 for information on the
- * values of these three parameters.
- *
- * The Pascal NDA must have two procedures (NDAClose and NDAInit) and
- * two functions (NDAOpen and NDAAction). These procedures and functions must
- * be identified to the linker as external with the $Z+ compiler directive.
- *
- * The required functions and procedures (NDAOpen, NDAClose, NDAAction and
- * NDAInit) are described the Desk Manager chapter of the Apple IIGS Toolbox
- * Reference: Volume 1. Here is the description of how they must be declared
- * and used in your Pascal NDA:
- *
- *****
- * The NDAOpen Function
- *
- * Syntax: FUNCTION NDAOpen: WindowPtr;
- *
- * The NDAOpen function is called when the NDA is selected from the Apple
- * menu. NDAOpen returns a pointer to the NDA's window.
- *
- *****
- * The NDAClose Procedure
- *
- * Syntax: PROCEDURE NDAClose;
- *
- * The NDAClose procedure has no inputs or outputs and must be able to work
- * even if the desk accessory is not open.
- *
- *****
- * The NDAAction Function
- *
- * Syntax: FUNCTION NDAAction(code: Integer;
- * evntRecPtr: EventRecordPtr): integer;
- *
- * The NDAAction function is called whenever there is an action or event the
- * NDA needs to handle. The action code is passed in the code variable. If the
- * code is eventAction, the the variable evntRecPtr is a pointer to the event
- * record. NDAAction returns a integer indicating whether the edit Action
- * commands (undoAction, cutAction, copyAction, pasteAction, clearAction) were
- * handled (non-zero = NDA handled edit Action).
- *
- *****
- * The NDAInit Procedure
- *
- * Syntax: PROCEDURE NDAInit(code: Integer);
- *
- * The NDAInit procedure is called every time DeskStartUp or DeskShutDown is
- * called. The code variable indicates which call was made. A zero value
- * indicates a DeskShutDown call; a non-zero value indicates a DeskStartUp
- * call.
- *
- *******************************************************************************
-
- CASE OBJ
-
- NDAHEADER PROC EXPORT
-
- ; Procedures and Functions in UPPER case
- IMPORT NDAOPEN,NDACLOSE,NDAACTION,NDAINIT
-
- dc.l NDAOPEN ; Pointer to the open routine
- dc.l NDACLOSE ; Pointer to the close routine
- dc.l AsmAction ; Pointer to the action routine glue
- dc.l AsmInit ; Pointer to the init routine glue
- NDAPeriod dc.w $0000 ; How often the NDA gets run actions
- NDAEventMask dc.w $FFFF ; Describes what events the NDA wants
- dc.b '**' ; two place-holding characters
- NDAMenuLine dc.b 'ActionNDA' ; A default NDA menu item name
- dc.b '\H**' ; \H and two place-holding characters
- dc.b 0 ; The menu item string terminator
-
- AsmAction pha ; reserve space for integer result
- pha ; push the action code
- phy ; push high word of event record addr
- phx ; push low word of event record addr
- jsl NDAACTION ; call the action routine
- pla ; get the integer result
- rtl ; and return
-
- AsmInit pha ; push the init code
- jsl NDAINIT ; call the init routine
- rtl ; and return
-
- ENDP
-
- END
-